Why XML?

XML (Extensible Markup Language) has revolutionized the way in which we exchange data on the Internet and between applications. The simple examples below illustrate the flexibility and power of XML over existing, and very popular markup languages, such as HTML.


Suppose you have data such as a name and date of birth which you want to share with other programs or people. There are many ways you can store this information:

Example 1. Storing data in a text file:

John Citizen, 01/01/2000.

Example 2. Storing data in an HTML file:

<html>
<head><title>Name and Date of Births</title></head>
<body>
  <table>
    <tr>
      <td>First Name</td><td>Last Name</td><td>Date of Birth</td>
    </tr>
    <tr>
      <td>John</td><td>Citizen</td><td>01/01/2001</td>
    </tr>
  </table>
</body>
</html>

Example 3. Storing data in an XML file:

<name>
  <first>John</first>
  <last>John</last>
</name>
<date_of_birth>
  <month>January</month>
  <day>01</day>
  <year>2001</year>
</date_of_birth>

The examples above illustrate some major advantages of XML: